Telegram Group & Telegram Channel
Screencast from 2024-08-25 19-08-56.webm
10.3 MB
🤖 ChatGPT и Claude AI в API могут запускать функции (functions) или инструменты (tools), которые находятся на сервере клиента. Если LLM считает, что нужно выполнить такую функцию, она передает команду серверу с аргументами для выполнения.

📖 Подробнее можно почитать здесь:
- OpenAI
- Claude

🖥 Вот пример, как функция выглядит для LLM:
{
"name": "get_weather",
"description": "Determine weather in my location",
"strict": true,
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": [
"c",
"f"
]
}
},
"additionalProperties": false,
"required": [
"location",
"unit"
]
}
}


А вот пример того, что видит сервер, когда его просят запустить функцию:

"tool_calls": [
{
"id": "call_fwTWdctuKEO9Ytf",
"name": "get_weather",
"arguments": "{\"location\":\"Moscow\",\"unit\":\"c\"}"
}
]


Сервер запускает функцию и возвращает результат. Причем в любом виде. Далее LLM уже сама придумает что с этим делать.

{
"id": "call_fwTWdctuKEO9Ytf",
"role": "tool",
"content": [
"{\"temp\":\"30\"}"
]
}


А теперь редставьте, что у вас умный дом, и вы говорите: "Включи чайник, я хочу пить". Описываем функции, которые помогут LLM посмотреть что у нас есть в квартире и управлять устройствами:

{
"key": "list_room_devices",
"description": "Lists all smart devices in a specified room.",
"input_schema": {
"type": "object",
"properties": {
"room_name": {
"type": "string",
"description": "The name of the room to query"
}
},
"required": ["room_name"]
}
}


{
"key": "control_device",
"description": "Controls a specific device by performing the specified action with given parameters.",
"input_schema": {
"type": "object",
"properties": {
"deviceId": {
"type": "string",
"description": "The unique identifier of the device to control"
},
"action": {
"type": "string",
"description": "The action to perform on the device (e.g., turnOn, turnOff, setBrightness)"
},
...
},
"required": ["deviceId", "action"]
}
}


Что сделает LLM? Она проанализирует ваш запрос, найдет подходящие функции, получит список устройств на кухне (ведь обычно чайник там), и выполнит нужное действие (включит чайник).

Круто, да? А теперь представьте PHP-фреймворк, который позволит описывать такие процессы (flow) и возьмет на себя сложные задачи, такие как запуск функций, группировку функций по назначению.

P.S. После прочтения, можно пересмотреть видео заново. В этом видео агент для управления умным домом, в котором 4 комнаты и куча устройств. Управление текстом или голосом (с переводом в текст)

#llm #ai #chatgpt #claude #php
Please open Telegram to view this post
VIEW IN TELEGRAM
4🔥153🤮1



tg-me.com/php_fart/103
Create:
Last Update:

🤖 ChatGPT и Claude AI в API могут запускать функции (functions) или инструменты (tools), которые находятся на сервере клиента. Если LLM считает, что нужно выполнить такую функцию, она передает команду серверу с аргументами для выполнения.

📖 Подробнее можно почитать здесь:
- OpenAI
- Claude

🖥 Вот пример, как функция выглядит для LLM:

{
"name": "get_weather",
"description": "Determine weather in my location",
"strict": true,
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": [
"c",
"f"
]
}
},
"additionalProperties": false,
"required": [
"location",
"unit"
]
}
}


А вот пример того, что видит сервер, когда его просят запустить функцию:

"tool_calls": [
{
"id": "call_fwTWdctuKEO9Ytf",
"name": "get_weather",
"arguments": "{\"location\":\"Moscow\",\"unit\":\"c\"}"
}
]


Сервер запускает функцию и возвращает результат. Причем в любом виде. Далее LLM уже сама придумает что с этим делать.

{
"id": "call_fwTWdctuKEO9Ytf",
"role": "tool",
"content": [
"{\"temp\":\"30\"}"
]
}


А теперь редставьте, что у вас умный дом, и вы говорите: "Включи чайник, я хочу пить". Описываем функции, которые помогут LLM посмотреть что у нас есть в квартире и управлять устройствами:

{
"key": "list_room_devices",
"description": "Lists all smart devices in a specified room.",
"input_schema": {
"type": "object",
"properties": {
"room_name": {
"type": "string",
"description": "The name of the room to query"
}
},
"required": ["room_name"]
}
}


{
"key": "control_device",
"description": "Controls a specific device by performing the specified action with given parameters.",
"input_schema": {
"type": "object",
"properties": {
"deviceId": {
"type": "string",
"description": "The unique identifier of the device to control"
},
"action": {
"type": "string",
"description": "The action to perform on the device (e.g., turnOn, turnOff, setBrightness)"
},
...
},
"required": ["deviceId", "action"]
}
}


Что сделает LLM? Она проанализирует ваш запрос, найдет подходящие функции, получит список устройств на кухне (ведь обычно чайник там), и выполнит нужное действие (включит чайник).

Круто, да? А теперь представьте PHP-фреймворк, который позволит описывать такие процессы (flow) и возьмет на себя сложные задачи, такие как запуск функций, группировку функций по назначению.

P.S. После прочтения, можно пересмотреть видео заново. В этом видео агент для управления умным домом, в котором 4 комнаты и куча устройств. Управление текстом или голосом (с переводом в текст)

#llm #ai #chatgpt #claude #php

BY PHP Fart Time


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/php_fart/103

View MORE
Open in Telegram


PHP Fart Time Telegram | DID YOU KNOW?

Date: |

A Telegram spokesman declined to comment on the bond issue or the amount of the debt the company has due. The spokesman said Telegram’s equipment and bandwidth costs are growing because it has consistently posted more than 40% year-to-year growth in users.

Telegram Auto-Delete Messages in Any Chat

Some messages aren’t supposed to last forever. There are some Telegram groups and conversations where it’s best if messages are automatically deleted in a day or a week. Here’s how to auto-delete messages in any Telegram chat. You can enable the auto-delete feature on a per-chat basis. It works for both one-on-one conversations and group chats. Previously, you needed to use the Secret Chat feature to automatically delete messages after a set time. At the time of writing, you can choose to automatically delete messages after a day or a week. Telegram starts the timer once they are sent, not after they are read. This won’t affect the messages that were sent before enabling the feature.

PHP Fart Time from jp


Telegram PHP Fart Time
FROM USA